<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="app" uri="http://www.wanrenhui.com" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
	  <%@include file="/res/include/base-head.jsp"%>
	  <%@include file="/res/include/jquery-easyui.jsp"%>
	<script type="text/javascript" src="${pageContext.request.contextPath}/res/js/mall/shop.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/res/js/mall/product.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/res/js/mall/mallOrder.js"></script>
  </head>
  <body>
	<div class="easyui-layout" data-options="fit:true">
		<div data-options="region:'north',border:false,split:false">
	    	<form id="query-form" class="search_form clearfix">
	            <dl>
					<dt>店铺名称：</dt>
					<dd>
						<input name="name" id="name" type="text" class="txt" maxlength="16"/>
					</dd>
				</dl>
				<dl>
					<dt>类型：</dt>
					<dd>
	                	<select name="style" class="txt grid-10">
							<option value="">请选择</option>
							<option value="1">邻里店</option>
							<option value="2">社区店</option>
							<option value="3">便利店</option>
						</select>
					</dd>
				</dl>
				<dl>
					<dt>状态：</dt>
					<dd>
	                	<select name="status" class="txt grid-10">
							<option value="">请选择</option>
							<option value="1">正常</option>
							<option value="2">失效</option>
						</select>
					</dd>
				</dl>
				<dl>
					<dt>审核状态：</dt>
					<dd>
	                	<select name="auditStatus" class="txt grid-10">
							<option value="">请选择</option>
							<option value="1">未审核</option>
							<option value="2">审核通过</option>
							<option value="3">审核失败</option>
						</select>
					</dd>
				</dl>
	            <p class="search_form_btn">
	            	<input type="button" value="搜索" class="icon_serach" onclick="admin.shop.query()" />
	            </p>
	        </form>
	  	</div>
	    <div data-options="region:'center',border:false">
		    <table id="datagrid" data-options="url:'${pageContext.request.contextPath}/mall/shop/list',toolbar:'#toolbar'">
				<thead>
					<tr>
						<th data-options="field:'name',width:150,align:'left'">店铺名称</th>
						<th data-options="field:'status',width:80,align:'center',formatter:formatStatus">店铺状态</th>
						<th data-options="field:'auditStatus',width:80,align:'center',formatter:formatAuditStatus">审核状态</th>
						<th data-options="field:'type',width:80,align:'center',formatter:formatType">店铺类型</th>
						<th data-options="field:'strStyle',width:80,align:'center'">店铺种类</th>
						<th data-options="field:'communityName',width:80,align:'center'">社区</th>
						<th data-options="field:'address',width:150,align:'center'">地址</th>
						<th data-options="field:'phone',width:90,align:'center'">电话</th>
						<th data-options="field:'rate',width:70,align:'center'">分账比例</th>
						<th data-options="field:'isUseQuanPay',width:120,align:'center',formatter:formatIsUseQuanPay">是否支持圈币结算</th>
						<th data-options="field:'quanPayRate',width:80,align:'center'">商家圈币结算比例</th>
						<th data-options="field:'qqQuanPayRate',width:80,align:'center'">平台圈币结算比例</th>
						<th data-options="field:'userNick',width:90,align:'center'">创建人昵称</th>
						<th data-options="field:'strNewAt',width:150,align:'center'">创建时间</th>
			            <th data-options="field:'id',align:'center',width:250,formatter:formatOperation">操作</th>
					</tr>
				</thead>
			</table>
	  	</div>
	</div>

	<script type="text/javascript">
		function formatStatus(value,row,index) {
			var l_html = '有效';
			if (value==2) {
				l_html = '失效';
			}
			return l_html;
		}
		function formatAuditStatus(value,row,index) {
			var l_html = '未审核';
			if (value==2) {
				l_html = '审核通过';
			} else if (value==3) {
				l_html = '审核失败';
			}
			return l_html;
		}
		function formatType(value,row,index) {
			var l_html = '直营超市';
			if (value==2) {
				l_html = '圈商店铺';
			}
			return l_html;
		}
		function formatIsUseQuanPay(value,row,index) {
			var l_html = '已支持';
			if (value==2) {
				l_html = '否';
			}
			return l_html;
		}
		
		function formatOperation(value,row,index) {
			var l_html = '';
			l_html += '<a href="javascript:;" class="table_link"  onclick="admin.shop.detail('+row.id+')">查看</a>';
			l_html += '|<a href="javascript:;" class="table_link" onclick="admin.product.list('+row.id+',\''+row.name+'\')">查询产品</a>';
			/*
			if(row.type == 1){
				l_html += '|<a href="javascript:;" class="table_link" onclick="admin.product.toAdd('+row.id+')">发布产品</a>';
			}*/
			l_html += '|<a href="javascript:;" class="table_link" onclick="admin.mallOrder.list('+row.id+',\''+row.name+'\')">订单</a>';
			/*
			if (row.type == 2) {
				var hasRecommend = '首页推荐';
				if (row.hasRecommend == 1) {
					hasRecommend = '取消推荐';
				}
				l_html += '|<a href="javascript:;" class="table_link" onclick="admin.shop.setHasRecommend('+row.id+',\''+row.hasRecommend+'\')">'+hasRecommend+'</a>';
				l_html += '|<a href="javascript:;" class="table_link"  onclick="admin.shop.edit('+row.id+')">编辑</a>';
			}*/
			/*
			if (row.style == 3) {
				l_html += '|<a href="javascript:;" class="table_link"  onclick="admin.shop.community('+row.id+')">关联社区</a>';
			}*/
			
			/*
			if (row.isUseQuanPay == 1) {
				l_html += '|<a href="javascript:;" class="table_link"  onclick="admin.shop.setNoUseQuanPay('+row.id+')">禁用圈币</a>';
			}else{
				l_html += '|<a href="javascript:;" class="table_link"  onclick="admin.shop.setUseQuanPay('+row.id+')">启用圈币</a>';
			}*/
			if(row.status == 1){
				l_html += '|<a href="javascript:;" class="table_link" onclick="admin.shop.setNotValid('+row.id+')">设为无效</a>';
			}else{
				l_html += '|<a href="javascript:;" class="table_link" onclick="admin.shop.setIsValid('+row.id+')">设为有效</a>';
			}
			
			
			return l_html;
		}
	</script>
  </body>
</html>
